﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;

namespace BSCore
{
    public static class GameResources
    {
        public static List<Frame> Frames { get; set; }

        public static List<Sprite> Sprites { get; set; }

        public static List<SpriteSet> SpriteSets { get; set; }

        public static List<TextureSheet> TextureSheets { get; set; }


        public static  Frame GetFrameByID(int id)
        {
            foreach (Frame frame in Frames)
            {
                if (frame.ID == id)
                {
                    return frame;
                }
            }

            return null;
        }


        public static Sprite GetSpriteByID(int id)
        {
            foreach (Sprite sprite in Sprites)
            {
                if (sprite.ID == id)
                {
                    return sprite;
                }
            }

            return null;
        }

        public static SpriteSet GetSpriteSetByID(int id)
        {
            foreach (SpriteSet spriteSet in SpriteSets)
            {
                if (spriteSet.ID == id)
                {
                    return spriteSet;
                }
            }

            return null;
        }

        public static TextureSheet GetTextureSheetByID(int id)
        {
            foreach (TextureSheet textureSheet in TextureSheets)
            {
                if (textureSheet.ID == id)
                {
                    return textureSheet;
                }
            }

            return null;
        }

        public static void Update(GameTime gameTime)
        {
            foreach (Sprite sprite in Sprites)
            {
                sprite.Update(gameTime);
            }
        }



    }
}
